package edu.neu.highway.config;

import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.InfluxDBClientFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import static edu.neu.highway.constant.Constant.INFLUXDB_TOKEN;

/**
 * <h1>配置InfluxDB客户端</h1>
 */
@Configuration
public class InfluxdbClientConfig {

    @Bean
    public InfluxDBClient influxDBClient() {
        String bucket = "highway-flow-bucket";
        String org = "thu";
        return InfluxDBClientFactory.create(
                "http://192.168.44.100:8086",
                INFLUXDB_TOKEN.toCharArray(),
                org,
                bucket
        );
    }
}
